//
//  MSStorageUtils.m
//  JinliWallet
//
//  Created by 张玮 on 2018/10/19.
//  Copyright © 2018年 张玮. All rights reserved.
//

#import "MSStorageUtils.h"

@implementation MSStorageUtils

+ (MSStorageUtils *)shareInstance{
    static dispatch_once_t once;
    static id sharedInstance;
    dispatch_once(&once, ^{
        sharedInstance = [[self alloc] init];
    });
    return sharedInstance;
}

- (void)userDefaultSave:(id)val withKey:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:[NSString stringWithFormat:@"%@",val] forKey:key];
    [defaults synchronize];
}

- (void)userDefaultSaveIntValue:(NSInteger)intValue withKey:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setInteger:intValue forKey:key];
    [defaults synchronize];
}

- (NSInteger)userDefaultGetInt:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    return [defaults integerForKey:key];
}

- (void)userDefaultSaveBoolean:(BOOL)val withKey:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setBool:val forKey:key];
    [defaults synchronize];
}

- (id)userDefaultGet:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    return [defaults objectForKey:key];
}

- (BOOL)userDefaultGetBool:(NSString *)key{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    return [defaults boolForKey:key];
}





@end
